package com.code9xs.mapper;

import com.code9xs.pojo.UserActivity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
@Mapper
public interface UserActivityMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(UserActivity record);

    int insertSelective(UserActivity record);

    UserActivity selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(UserActivity record);

    int updateByPrimaryKey(UserActivity record);

    /**
     * 通过活动ID查询活动已参加人数
     * @param activityId
     * @return
     */
    int selectCountByActivityId(@Param("activityId") Integer activityId);

    /**
     * 通过用户id和活动id查询用户是否已经参加本次活动
     * @param uid
     * @param ActivityId
     * @return
     */
    int selectJoinedUserByUidAndActivityId(@Param("uid")Integer uid,@Param("activityId")Integer ActivityId);

    /**
     * 查询该用户参加的活动条数
     * @param uid
     * @return
     */
    int selectUserActivityCountByUid(@Param("uid") Integer uid);


    /**
     * 分页查询该用户参加的活动
     * @param uid
     * @param start
     * @param size
     * @return
     */
    List<Map<String,Object>> selectUserActivityByPagination(@Param("uid") Integer uid,@Param("start")Integer start,@Param("size")Integer size);

    /**
     * 通过社团主键查询当前社团人员数
     * @return
     */
    int selectCountByAid(@Param("aid")Integer aid);
}